/**
 * Copyright (C), 2015-2018, 周氏集团有限公司
 * FileName: UserController
 * Author:   Administrator
 * Date:     2018/8/16 2:31
 * Description: 用户控制层
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.zzg.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zzg.api.UserService;
import com.zzg.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 〈一句话功能简述〉<br> 
 * 〈用户控制层〉
 *
 * @author Administrator
 * @create 2018/8/16
 * @since 1.0.0
 */
@Controller
@RequestMapping(value = "/api/user")
public class UserController {
    @Autowired
    private UserService service;

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public int addUser(@RequestBody User user){
        return service.insert(user);
    }

    @RequestMapping(value = "/findById", method = RequestMethod.GET)
    @ResponseBody
    public User findById(@RequestParam Long id){
        return service.selectByPrimaryKey(id);
    }
}
